<?php
declare (strict_types = 1);

namespace hangpu8\hpcms\validate;

use think\Validate;

class AuthRule extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'title'                     => 'require|min:2|max:10',
        'path'                      => 'require|unique:authRule',
        'method'                    => 'require',
        'type'                      => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'title.require'             => ['code' => 1001, 'msg' => '请输入菜单名称'],
        'title.min'                 => ['code' => 1002, 'msg' => '菜单名称至少输入2个字'],
        'title.max'                 => ['code' => 1003, 'msg' => '菜单名称最多可输入10个字'],
        'path.require'              => ['code' => 1004, 'msg' => '请输入菜单地址'],
        'path.unique'               => ['code' => 1005, 'msg' => '该权限菜单地址已添加'],
        'method.require'            => ['code' => 1006, 'msg' => '请选择请求类型'],
        'type.require'              => ['code' => 1007, 'msg' => '请选择菜单类型'],
    ];
}
